﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using YBApproval.Model;

namespace YBApproval.UserControls
{
    public partial class UCApprovalForm : System.Web.UI.UserControl
    {
        public Button CancelButton
        {
            get { return this.btn_Deny; }
        }
        public Button SubmitButton
        {
            get { return this.btn_Submit; }
        }
        public Button CloseButton
        {
            get { return this.btn_Close; }
        }

        private bool _bApprove = false;
        public bool BApprove { get { return _bApprove; } }

        private bool _bDeny = false;
        public bool BDeny { get { return _bDeny; } }

        private bool _bClosed = false;
        public bool BClosed { get { return _bClosed; } }

        public string Comments { get { return txt_Comments.Text; } }

        public int ProcessId 
        { 
            get
            {
                return this.Approver1.ProcessId;
            }
            set
            {
                this.Approver1.ProcessId = value;
            }
        }
        public int NodeOrder 
        {
            get
            {
                return this.Approver1.NodeOrder;
            }
            set
            {
                this.Approver1.NodeOrder = value;
            }
        }
        public List<ApprovalView> Approvers
        {
            get
            {
                return this.Approver1.GetValues();
            }
        }

        public event EventHandler SubmitEvent;
        public event EventHandler DenyEvent;
        public event EventHandler CloseEvent;
        public event EventHandler CancelEvent;

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            _bApprove = true;
            SubmitEvent(this, e);
        }

        protected void btn_Deny_Click(object sender, EventArgs e)
        {
            _bDeny = true;
            DenyEvent(this, e);
        }

        protected void btn_Close_Click(object sender, EventArgs e)
        {
            _bClosed = true;
            CloseEvent(this, e);
        }

        protected void btn_Cancel_Click(object sender, EventArgs e)
        {
            CancelEvent(this, e);
        }
    }
}